import request from "@/utils/request";
//导入自定义数据类型
import type { Admin } from "@/model";
import type { Category, Goods, CutpageParam } from "@/model";
import type { User } from "@/model";
//管理员登录接口
export function login(data: Admin) {
  return request.post("/admin/login", data);
}
export function getAdmin() {
  return request.get("/admin/admin");
}
export function uploadPictureURL() {
  return "/admin/upload/picture";
}
//修改管理员头像
export function changeAdminAvatar(data: Admin) {
  return request.post("/admin/admin/changeAvatar", data);
}
export function changeAdminPassword(data: Admin) {
  return request.post("/admin/admin/changePassword", data);
}
export function getCategoryList() {
  return request.get("/admin/category/list");
}
//删除分类
export function delCategory(data: Category) {
  return request.post("/admin/category/del", data);
}
export function addCategory(data: Category) {
  return request.post("/admin/category/add", data);
}
//修改分类
export function updateCategory(data: Category) {
  return request.post("/admin/category/save", data);
}
export function getGoodsList(params: CutpageParam) {
  return request.get("/admin/goods/list", { params });
}
//删除商品
export function delGoods(data: Goods) {
  return request.post("/admin/goods/del", data);
}
export function addGoods(data: Goods) {
  return request.post("/admin/goods/add", data);
}
//修改商品
export function updateGoods(data: Goods) {
  return request.post("/admin/goods/save", data);
}
export function getUserList() {
  return request.get("/admin/user/list");
}
//添加用户
export function addUser(data: User) {
  return request.post("/admin/user/add", data);
}
//修改用户状态
export function changeState(data: User) {
  return request.post("/admin/user/changeState", data);
}
//修改用户信息
export function updateUser(data: User) {
  return request.post("/admin/user/save", data);
}
//删除用户信息
export function deleteUser(data: User) {
  return request.post("/admin/user/delete", data);
}
export function getAdminList() {
  return request.get("/admin/role/list");
}
//添加管理员
export function addAdmin(data: Admin) {
  return request.post("/admin/add", data);
}
//查询所有角色列表
export function getPermissionList() {
  return request.get("/admin/user/permission");
}
//修改管理员信息
export function updateAdmin(data: Admin) {
  return request.post("/admin/save", data);
}
//删除管理员信息
export function deleteAdmin(data: Admin) {
  return request.post("/admin/delete", data);
}
